package de.tum.in.eist.poll.shared;

import java.util.Date;

import com.google.gwt.user.client.rpc.IsSerializable;

/**
 * Representation of a Poll by its topic (optional), the date of the lecture,
 * the date it opens and the date it closes
 * @author max
 *
 */


public class Poll implements IsSerializable{
	private String topic = "";
	private Date date;
	private Date start;
	private Date end;
	
	
	//Konstruktor
	
	public Poll(String topic, Date date, Date start, Date end) {
		this(date, start, end);
		this.topic = topic;
	}

	public Poll(Date date, Date start, Date end) {
		this.date = date;
		this.start = start;
		this.end = end;
	}
	
	public Poll(){
		date = new Date();
		start = date;
		end = date;
	}
	
	//Setter

	public String getTopic() {
		return topic;
	}
	public Date getDate() {
		return date;
	}
	public Date getStart() {
		return start;
	}
	
	public Date getEnd() {
		return end;
	}
	
	//Getter

	public void setTopic(String topic) {
		this.topic = topic;
	}

	public void setStart(Date start) {
		this.start = start;
	}
	
	public void setEnd(Date end) {
		this.end = end;
	}
	
	@Override
	public boolean equals(Object p){
		return this.date == ((Poll) p).date;
	}
	
	
}
